<template>
  <div class="child">
    <h3>钱数：{{ modelValue }}</h3>
    <button @click="handler">父子组件数据同步</button>
  </div>
</template>

<script setup lang="ts">
// 接收props
let props = defineProps(["modelValue"]);
let $emit = defineEmits(["update:modelValue"]);
// 子组件内部按钮的点击回调
const handler = () => {
  // 触发自定义事件
  $emit("update:modelValue", props.modelValue + 1000);
};
</script>
<style scoped lang="less">
.child {
  width: 600px;
  height: 300px;
  background: skyblue;
}
</style>